Home:ALL Converter>Remove GMT- from javascript clock output

Remove GMT- from javascript clock output

Ask Time:2020-02-24T00:54:49         Author:Konabob

Json Formatter

The following script generates the following output: "Sun Feb 23 2020 06:35:14 GMT-1000 (HST)"

I would like to strip out "GMT-1000 " and display only "Sun Feb 23 2020 06:35:14 (HST)".

I don't know where the GMT-1000 is generated, so can't understand how to implement

str.replace("GMT-1000", " ");

What can I do?

function display_c(){
var refresh=1000; // Refresh rate in milli seconds
mytime=setTimeout('display_ct()',refresh)
}

function display_ct() {
var x = new Date()
document.getElementById('ct').innerHTML = x;
var ct = str.replace("GMT-1000", " ");      
display_c();
 }

Author:Konabob,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/60364590/remove-gmt-from-javascript-clock-output
Ghoul Ahmed :

try this\n\n\r\n\r\nconst date = 'Sun Feb 23 2020 06:35:14 GMT-1000 (HST)';\r\nconst convertDate = date => new Date(date).toUTCString().split(' ').slice(0, 5).join(' ');\r\nconsole.log(convertDate(date));",
2020-02-23T17:08:55
yy